<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>{$title}_美动传媒</title>
<!--<link rel="stylesheet/less" href="__PUBLIC__/css/style.less" />
<script src="__PUBLIC__/js/less-1.5.0.min.js"></script>
-->
<link rel="stylesheet" href="__PUBLIC__/css/style.css" />
<link rel="stylesheet" href="__PUBLIC__/css/font-awesome.min.css">

<!--[if IE]>
   <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<script type="text/javascript" src="__PUBLIC__/js/jquery-1.8.2.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	
	
	$("#submit").on("click", function () {
		
		if($('#truename').val()){
			if($('#phone').val()){
				if(phoneGeShi($('#phone').val())){
					if(checkphone()){
						var term = getterm();
						$.post("__MODULE__/ActData/create",term, function (result) {
							if(result=="ok"){
								alert("报名成功");
									$('#truename').val('');
									$('#phone').val('');
				             	
				       		}else {
				       			alert("报名失败");
				       		}
						});
					}else{
						alert("此号码已存在");
					}
				}else {
					alert("手机号格式错误");
				}
				
			}else{
				alert("请填写电话");
			}
			
	    }else{
	    	alert("请输入姓名");
	    }
		
		
	});
	
	
	function getterm(){
		var term = '';
		var truename = $('#truename').val();
	    var phone = $('#phone').val();
	    var act_id = $('#act_id').val();
	    if(truename){
	    	term+='&truename='+truename;
	    }
	    if(phone){
	    	term+='&phone='+phone;
	    }
	    if(act_id){
	    	term+='&act_id='+act_id;
	    }
	    return term;
	}
	
	function checkphone(){
		var checkResult = false;
        var term = "";
        var phone = $("#phone").val();
        var act_id = $("#act_id").val();
        term += "act_id=" + act_id;
        if (phone) {
        	term += "&phone=" + phone;
        }else{
        	return true
        }
        $.ajax({
            type: 'post',
            url: "__URL__/checkphone",
            data: term,
            async: false,
            success: function (data) {
                if ($.trim(data) == 'ok') {
                	checkResult = true;
                } else {
                    checkResult = false;
                }
            }
        });
        return checkResult;
	}
	
	function phoneGeShi(phone){
		var res = /^(1[3-8]\d{9})$/.test(phone);
	    return res;
	}
	
});



</script>


</head>
<body>
<header class="cc">
	<a href="__MODULE__/Index/index" class="logo">嘉兴社区平台</a>
	<div class="search">
	  <form action="__MODULE__/Act/index" method="get">
		<input type="text" name="keyword" class="k" value='{$keyword}'>
		<button type="submit" class="icon-search"></button>
	  </form>	
	</div>
	<div class="sns-contact">
		<div class="sns">
			<a href="" class="weixin">weixin</a>
			<a href="" class="weibo">weibo</a>
			<a href=""  class="qq">qq</a>
		</div>
		<div class="contact">
			<a href="">联系我们</a> |
			客服电话：0573-83778008
		</div>
	</div>
</header>

<nav>
	<include file="Public:nav" />
</nav>

<div class="home-index">
	<ol class="breadcrumb">
	  <li>首页</li>
	  <li class="active"><a href="__MODULE__/Act/info/id/{$act_id}">{$title}</a></li>
	  <li>活动报名</li>
	</ol>
	

	<div class="act-form">
			
			<div class="content">
			
			<form action="__MODULE__/ActData/create">
				<div class="form-group">
				    <label class="sr-only" >您的姓名：</label>
				    <input type="text" id="truename" class="form-control"  placeholder="请输入您的姓名">
				  </div>
				  <div class="form-group">
				    <label class="sr-only" >联系电话：</label>
				    <input type="text" id="phone" class="form-control"  placeholder="请输入联系电话">
				  </div>
				  <input type="hidden" id="act_id"  value='{$act_id}' >
				  <button type="button" id="submit" class="btn btn-default">提交</button>
			</form>
			</div>
	</div>
	
</div>

<footer>
	<p>公司地址：嘉兴市南湖区富民路105号（嘉兴国际创意文化产业园内）</p>
	<p>电话：0573-83778008   传真：0573-82623018  电子邮箱：meidong@vip.sina.com</p>
	<p>Copyright 2012 Shequlianbo.com 美动传媒 </p>

</footer>
</body>
</html>